#ifndef DATA_SCENE_H
#define DATA_SCENE_H

#include "Common/Collections/Vector.h"

#include "Data/Objects/Creature.h"
#include "Data/Objects/Player.h"
#include "Data/Objects/Map.h"
#include "Data/Objects/Camera.h"

namespace data {

	class Scene {
	public:
		Scene(
			std::string name,
			std::string description,
			std::string mapFileName,
			const Camera& camera ) :
			m_name( name ),
			m_description( description ),
			m_mapFileName( mapFileName ),
			m_camera( camera )
		{
			m_players = new cmn::Vector<Player>();
			m_creatures = new cmn::Vector<Creature>();
		}

		Scene( const Scene& scene ) :
			m_name( scene.m_name ),
			m_description( scene.m_description ),
			m_mapFileName( scene.m_mapFileName ),
			m_camera( scene.m_camera )
		{
			m_players = new cmn::Vector<Player> ( scene.m_players );
			m_creatures = new cmn::Vector<Creature> ( scene.m_creatures );
		}

		~Scene() {
			delete m_creatures;
			delete m_players;
		}

		inline const std::string GetName() const { return m_name; }
		inline void SetName( std::string name ) { m_name = name; }

		inline const std::string GetDescription() const { return m_description; }
		inline void SetDescription( std::string description ) { m_description = description; }

		inline const std::string GetMapFileName() const { return m_mapFileName; }
		inline void SetMapFileName( std::string mapFileName ) { m_mapFileName = mapFileName; }

		inline Camera GetCamera() const { return m_camera; }
		inline void SetCamera( const Camera& camera ) { m_camera = camera; }

		inline void AddPlayer( const Player& player ) { m_players->Add( player ); }
		inline void RemovePlayer( const Player& player ) { m_players->Remove( player ); }
		inline const cmn::IIterable<Player>* GetPlayers() const { return m_players; }

		inline void AddCreature( const Creature& creature ) { m_creatures->Add( creature ); }
		inline void RemoveCreature( const Creature& creature ) { m_creatures->Remove( creature ); }
		inline const cmn::IIterable<Creature>* GetCreatures() const { return m_creatures; }

	private:
		std::string m_name;
		std::string m_description;
		std::string m_mapFileName;
		Camera m_camera;

		cmn::Vector<Player>* m_players;
		cmn::Vector<Creature>* m_creatures;
	};

	inline bool operator == ( const Scene& a, const Scene& b ) {

		if( a.GetName() != b.GetName() ) return false;
		if( a.GetDescription() != b.GetDescription() ) return false;
		if( a.GetMapFileName() != b.GetMapFileName() ) return false;
		if( a.GetCamera() != b.GetCamera() ) return false;

		if( !IterablesAreEqual( a.GetPlayers(), b.GetPlayers() ) ) return false;
		if( !IterablesAreEqual( a.GetCreatures(), b.GetCreatures() ) ) return false;
		return true;
	}

	inline bool operator != ( const Scene& a, const Scene& b ) {
		return !( a == b );
	}
}
#endif
